object dmDadosNotasSaida: TdmDadosNotasSaida
  OldCreateOrder = False
  Left = 351
  Top = 120
  Height = 441
  Width = 683
  object sqlProduto: TSQLDataSet
    SchemaName = 'root'
    CommandText = 'Select *'#13#10'from tblpro'#13#10'where procodbarra = :procodbarra'
    DbxCommandType = 'Dbx.SQL'
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftString
        Name = 'procodbarra'
        ParamType = ptInput
      end>
    SQLConnection = dmConexao.SQLConnection
    Left = 29
    Top = 192
    object sqlProdutoprocod: TIntegerField
      FieldName = 'procod'
      Required = True
    end
    object sqlProdutoprodescr: TStringField
      FieldName = 'prodescr'
      Required = True
      Size = 50
    end
    object sqlProdutounduni: TStringField
      FieldName = 'unduni'
      Required = True
      Size = 2
    end
    object sqlProdutoprocodbarra: TStringField
      FieldName = 'procodbarra'
      Required = True
      Size = 13
    end
    object sqlProdutoproaliqicms: TFMTBCDField
      FieldName = 'proaliqicms'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
    object sqlProdutoprovlunit: TFMTBCDField
      FieldName = 'provlunit'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
    object sqlProdutoprovlprven: TFMTBCDField
      FieldName = 'provlprven'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
    object sqlProdutoproqtdeest: TIntegerField
      FieldName = 'proqtdeest'
      Required = True
      DisplayFormat = '#,##0'
    end
    object sqlProdutofapcod: TIntegerField
      FieldName = 'fapcod'
      Required = True
    end
    object sqlProdutoproncm: TIntegerField
      FieldName = 'proncm'
      Required = True
    end
  end
  object cdsItens: TClientDataSet
    Aggregates = <>
    AggregatesActive = True
    Params = <>
    Left = 32
    Top = 136
    object cdsItenspos: TIntegerField
      FieldName = 'pos'
    end
    object cdsItensprocod: TIntegerField
      FieldName = 'procod'
    end
    object cdsItensprodescr: TStringField
      FieldName = 'prodescr'
      Size = 50
    end
    object cdsItensunduni: TStringField
      FieldName = 'unduni'
      Size = 2
    end
    object cdsItensprocodbarra: TStringField
      FieldName = 'procodbarra'
      Size = 13
    end
    object cdsItensproaliqicms: TBCDField
      FieldName = 'proaliqicms'
      DisplayFormat = '#,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsItensproqtde: TIntegerField
      FieldName = 'proqtde'
      DisplayFormat = '#,##0'
    end
    object cdsItensprovlprven: TBCDField
      FieldName = 'provlprven'
      DisplayFormat = '#,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsItensprovlprtot: TBCDField
      FieldName = 'provlprtot'
      DisplayFormat = '#,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsItensnamaliqnac: TFloatField
      FieldName = 'namaliqnac'
    end
    object cdsItensSubTotal: TAggregateField
      FieldName = 'SubTotal'
      Active = True
      Expression = 'sum(provlprtot)'
    end
  end
  object cdsCliente: TClientDataSet
    Aggregates = <>
    Params = <>
    Left = 32
    Top = 80
    object cdsClienteTipo: TIntegerField
      FieldName = 'Tipo'
    end
    object cdsClienteCNPJ: TStringField
      FieldName = 'CNPJ'
      OnValidate = cdsClienteCNPJValidate
      Size = 18
    end
    object cdsClienteIE: TStringField
      FieldName = 'IE'
      Size = 15
    end
    object cdsClienteRazaoSocial: TStringField
      FieldName = 'RazaoSocial'
      OnValidate = cdsClienteRazaoSocialValidate
      Size = 50
    end
  end
  object cdsValores: TClientDataSet
    Aggregates = <>
    Params = <>
    Left = 32
    Top = 32
    object cdsValoresTipoVenda: TIntegerField
      FieldName = 'TipoVenda'
    end
    object cdsValoresSubTotal: TBCDField
      FieldName = 'SubTotal'
      DisplayFormat = 'R$ #,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsValoresPercDesc: TBCDField
      FieldName = 'PercDesc'
      OnValidate = cdsValoresPercDescValidate
      DisplayFormat = '#,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsValoresValorDesc: TBCDField
      FieldName = 'ValorDesc'
      DisplayFormat = 'R$ #,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsValoresValorTotal: TBCDField
      FieldName = 'ValorTotal'
      DisplayFormat = 'R$ #,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsValoresFormaPagto: TIntegerField
      FieldName = 'FormaPagto'
    end
    object cdsValoresValorPagto: TBCDField
      FieldName = 'ValorPagto'
      OnValidate = cdsValoresValorPagtoValidate
      DisplayFormat = 'R$ #,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsValoresValorTroco: TBCDField
      FieldName = 'ValorTroco'
      OnValidate = cdsValoresValorTrocoValidate
      DisplayFormat = 'R$ #,##0.00'
      Precision = 12
      Size = 2
    end
    object cdsValoresValorImposto: TFloatField
      FieldName = 'ValorImposto'
    end
    object cdsValoresPercImposto: TFloatField
      FieldName = 'PercImposto'
    end
  end
  object sqlMaxNfscod: TSQLDataSet
    SchemaName = 'root'
    CommandText = 
      'select max(nfscod) as nfscod'#13#10'from tblnfs'#13#10'where nfsserie = :nfs' +
      'serie'
    DbxCommandType = 'Dbx.SQL'
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftString
        Name = 'nfsserie'
        ParamType = ptInput
      end>
    SQLConnection = dmConexao.SQLConnection
    Left = 30
    Top = 296
    object sqlMaxNfscodnfscod: TIntegerField
      FieldName = 'nfscod'
    end
  end
  object sqlTblnfs: TSQLDataSet
    CommandText = 'select * from tblnfs'
    DbxCommandType = 'Dbx.SQL'
    MaxBlobSize = -1
    Params = <>
    SQLConnection = dmConexao.SQLConnection
    Left = 432
    Top = 32
  end
  object dspTblnfs: TDataSetProvider
    DataSet = sqlTblnfs
    OnUpdateError = dspTblnfsUpdateError
    Left = 432
    Top = 80
  end
  object cdsTblnfs: TClientDataSet
    Aggregates = <>
    AggregatesActive = True
    Params = <>
    ProviderName = 'dspTblnfs'
    OnCalcFields = cdsTblnfsCalcFields
    Left = 432
    Top = 128
    object cdsTblnfsnfscod: TIntegerField
      FieldName = 'nfscod'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object cdsTblnfsnfsserie: TStringField
      FieldName = 'nfsserie'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
      Size = 3
    end
    object cdsTblnfsnfsdtemis: TDateField
      FieldName = 'nfsdtemis'
      Required = True
    end
    object cdsTblnfsnfstip: TIntegerField
      FieldName = 'nfstip'
      Required = True
    end
    object cdsTblnfsLookupTipVenda: TStringField
      FieldKind = fkLookup
      FieldName = 'LookupTipVenda'
      LookupDataSet = dmDadosGlobal.cdsTipoVenda
      LookupKeyFields = 'Codigo'
      LookupResultField = 'Descr'
      KeyFields = 'nfstip'
      Size = 15
      Lookup = True
    end
    object cdsTblnfsnfsclitip: TIntegerField
      FieldName = 'nfsclitip'
      Required = True
    end
    object cdsTblnfsnfscnpj: TStringField
      FieldName = 'nfscnpj'
      Size = 18
    end
    object cdsTblnfsnfsrazaosocial: TStringField
      FieldName = 'nfsrazaosocial'
      Size = 60
    end
    object cdsTblnfsnfsie: TStringField
      FieldName = 'nfsie'
      Size = 15
    end
    object cdsTblnfsnfsvldesc: TFMTBCDField
      FieldName = 'nfsvldesc'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
    object cdsTblnfsnfsvltotnf: TFMTBCDField
      FieldName = 'nfsvltotnf'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
    object cdsTblnfsnfstippagto: TIntegerField
      FieldName = 'nfstippagto'
      Required = True
    end
    object cdsTblnfsLookupTippagto: TStringField
      FieldKind = fkLookup
      FieldName = 'LookupTippagto'
      LookupDataSet = dmDadosGlobal.cdsFormaPagto
      LookupKeyFields = 'Codigo'
      LookupResultField = 'Descr'
      KeyFields = 'nfstippagto'
      Size = 15
      Lookup = True
    end
    object cdsTblnfsnfsnrocupom: TIntegerField
      FieldName = 'nfsnrocupom'
      Required = True
    end
    object cdsTblnfssqlTblins: TDataSetField
      FieldName = 'sqlTblins'
    end
    object cdsTblnfsCalcPercdesc: TFloatField
      FieldKind = fkInternalCalc
      FieldName = 'CalcPercdesc'
      DisplayFormat = '#,##0.00'
    end
    object cdsTblnfsAggSumNfsvltotnf: TAggregateField
      Alignment = taRightJustify
      FieldName = 'AggSumNfsvltotnf'
      Active = True
      DisplayFormat = '#,##0.00'
      Expression = 'sum(nfsvltotnf)'
    end
    object cdsTblnfsAggSumNfsvldesc: TAggregateField
      Alignment = taRightJustify
      FieldName = 'AggSumNfsvldesc'
      Active = True
      DisplayFormat = '#,##0.00'
      Expression = 'sum(nfsvldesc)'
    end
  end
  object sqlTblins: TSQLDataSet
    SchemaName = 'root'
    CommandText = 
      'select tblins.inspos, tblins.procod,'#13#10'           tblpro.prodescr' +
      ', tblfap.fapdescr,'#13#10'           tblins.insqtde,'#13#10'           tblin' +
      's.insvlunit, tblins.insvltot'#13#10'  from tblins, tblpro, tblfap'#13#10'whe' +
      're tblins.procod = tblpro.procod'#13#10'    and tblpro.fapcod = tblfap' +
      '.fapcod'#13#10'    and tblins.nfscod = :nfscod'#13#10'    and tblins.nfsseri' +
      'e = :nfsserie'#13#10'order by tblins.inspos'
    DbxCommandType = 'Dbx.SQL'
    DataSource = dsTblnfsTblins
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'nfscod'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'nfsserie'
        ParamType = ptInput
      end>
    SQLConnection = dmConexao.SQLConnection
    Left = 576
    Top = 32
  end
  object cdsTblins: TClientDataSet
    Aggregates = <>
    DataSetField = cdsTblnfssqlTblins
    PacketRecords = 0
    Params = <>
    Left = 504
    Top = 128
    object cdsTblinsinspos: TIntegerField
      FieldName = 'inspos'
      Required = True
    end
    object cdsTblinsprocod: TIntegerField
      FieldName = 'procod'
      Required = True
    end
    object cdsTblinsprodescr: TStringField
      FieldName = 'prodescr'
      Required = True
      Size = 50
    end
    object cdsTblinsfapdescr: TStringField
      FieldName = 'fapdescr'
      Required = True
      Size = 45
    end
    object cdsTblinsinsqtde: TIntegerField
      FieldName = 'insqtde'
      Required = True
      DisplayFormat = '#,##0'
    end
    object cdsTblinsinsvlunit: TFMTBCDField
      FieldName = 'insvlunit'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
    object cdsTblinsinsvltot: TFMTBCDField
      FieldName = 'insvltot'
      Required = True
      DisplayFormat = '#,##0.00'
      Precision = 14
      Size = 2
    end
  end
  object dsTblnfsTblins: TDataSource
    DataSet = sqlTblnfs
    Left = 504
    Top = 32
  end
  object sqlInsertTblnfs: TSQLDataSet
    CommandText = 
      'insert into tblnfs values (:nfscod, :nfsserie, :nfsdtemis, :nfst' +
      'ip, :nfsclitip, :nfscnpj, :nfsrazaosocial, :nfsie, :nfsvldesc, :' +
      'nfsvltotnf, :nfstippagto, :nfsnrocupom)'
    DbxCommandType = 'Dbx.SQL'
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'nfscod'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'nfsserie'
        ParamType = ptInput
      end
      item
        DataType = ftDate
        Name = 'nfsdtemis'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'nfstip'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'nfsclitip'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'nfscnpj'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'nfsrazaosocial'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'nfsie'
        ParamType = ptInput
      end
      item
        DataType = ftFloat
        Name = 'nfsvldesc'
        ParamType = ptInput
      end
      item
        DataType = ftFloat
        Name = 'nfsvltotnf'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'nfstippagto'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'nfsnrocupom'
        ParamType = ptInput
      end>
    SQLConnection = dmConexao.SQLConnection
    Left = 128
    Top = 32
  end
  object sqlInsertTblins: TSQLDataSet
    CommandText = 
      'insert into tblins values(:nfscod, :nfsserie, :inspos, :procod, ' +
      ':insqtde, :insvlunit, :insvltot, :insaliqicms)'
    DbxCommandType = 'Dbx.SQL'
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'nfscod'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'nfsserie'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'inspos'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'procod'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'insqtde'
        ParamType = ptInput
      end
      item
        DataType = ftFloat
        Name = 'insvlunit'
        ParamType = ptInput
      end
      item
        DataType = ftFloat
        Name = 'insvltot'
        ParamType = ptInput
      end
      item
        DataType = ftFloat
        Name = 'insaliqicms'
        ParamType = ptInput
      end>
    SQLConnection = dmConexao.SQLConnection
    Left = 128
    Top = 80
  end
  object sqlImposto: TSQLDataSet
    SchemaName = 'root'
    CommandText = 
      'select namaliqnac'#13#10'from tblnam'#13#10'where namcod = :namcod'#13#10'and name' +
      'xce = '#39#39#13#10'and namtip = 0'
    DbxCommandType = 'Dbx.SQL'
    MaxBlobSize = -1
    Params = <
      item
        DataType = ftInteger
        Name = 'namcod'
        ParamType = ptInput
      end>
    SQLConnection = dmConexao.SQLConnection
    Left = 32
    Top = 248
    object sqlImpostonamaliqnac: TFMTBCDField
      FieldName = 'namaliqnac'
      Required = True
      Precision = 7
      Size = 2
    end
  end
end
